{% extends 'base.html' %}
{% load static %}
{% load highlight %}
{% block title %}新闻搜索{% endblock %}

{#  主体内容  #}
{% block content %}
    <div id="search">
        <div class="container">
            <div class="search-title">
                <h4 class="mode-title">关于“{{ query }}”的结果 </h4>
                <div class="col-md-4 search">
                    <form method="get" action="{% url 'haystack_search' %}">
                        <div class="input-group">
                            <input type="text" name="q" class="form-control" placeholder="请输入关键词" required/>
                            <span class="input-group-btn">
                             <input type="submit" class="btn btn-default" value="搜索"/>
                        </span>
                        </div>
                    </form>
                </div>
            </div>
            {% for item in page.object_list %}
                <div class="new-item">
                    <div class="new-title row">
                        <div class="col-md-10">
                            <img src="{% static 'images/newsicon.gif' %}" alt="icon"/>
                            <a href="{% url 'new_detail' item.object.id %}">{{ item.object.title }}</a>
                        </div>
                        <div class="col-md-2 text-right">【{{ item.object.pubDate | date:"Y-m-d" }}】</div>
                    </div>
                    <div class="new-content padding2">{{ item.object.content|striptags|truncatechars:"100" }}</div>
                </div>
            {% endfor %}
        </div>
    </div>
{% endblock %}